#include "manager.h"
#include "ui_manager.h"
#include <QPixmap>
#include <QPalette>
manager::manager(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::manager)
{
    ui->setupUi(this);
    this->setWindowTitle("管理题库");
    QPixmap pixmap = QPixmap(":/img/bg3.jpg");
    QPixmap pix = pixmap.scaled(this->size());
    QPalette pal;
    pal.setBrush(QPalette::Background,QBrush(pix));
    this->setPalette(pal);
    add = new addquestion;
    upd = new Updateque;
    del = new Deleteque;

}

manager::~manager()
{
    delete ui;
}

void manager::on_pushButton_back_clicked()
{
    emit back();
}

void manager::on_pushButton_add_clicked()
{
    this->hide();
    add->show();
    connect(add,&addquestion::add_exit,[=](){add->close();this->show();});
}

void manager::add_exit()
{
    add->close();
    this->show();
}

void manager::on_pushButton_update_clicked()
{
    this->hide();
    upd->show();
    connect(upd,&Updateque::upd_exit,this,&manager::add_exit);
}

void manager::upd_exit()
{
    upd->close();
    this->show();
}

void manager::on_pushButton_delete_clicked()
{
    this->hide();
    del->show();
    connect(del,&Deleteque::del_exit,this,&manager::del_exit);
}

void manager::del_exit()
{
    del->close();
    this->show();
}
